package com.bjwl.service.impl;

import com.bjwl.dao.CustomerMapper;
import com.bjwl.pojo.Customer;
import com.bjwl.pojo.Status;
import com.bjwl.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author: czc
 * @Date:Create：in 2020/4/9 15:04
 * @Description:客户业务逻辑层实现类，目前有增删改查
 * @Modified By：
 * @Version: 1.0
 */
@Service
public class CustomerServiceImpl implements CustomerService {

    @Autowired
    private CustomerMapper customerMapper;

    //查询客户所有实现类
    @Override
    public List<Customer> findAllCustomer() {
        return customerMapper.findAllCustomer();
    }

    //添加客户实现类
    @Override
    @Transactional
    public int addCustomer(Customer customer) {
        return customerMapper.addCustomer(customer);
    }

    //删除用户实现类
    @Override
    @Transactional
    public void deleteCustomer(Integer id) {
         customerMapper.deleteCustomer(id);
    }

    //通过id修改客户信息实现类
    @Override
    @Transactional
    public Integer byIdUpdateCustomer(Customer customer ) {
        return customerMapper.byIdUpdateCustomer(customer);
    }

    @Override
    @Transactional
    public Customer byCnameFindCustomer(Customer customer) {
        return customerMapper.byCnameFindCustomer(customer);
    }
}
